package com.humble.vichatbackend.model.elastic.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

//ES中User需要搜索的内容
@Document(indexName="user")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ElasticUser extends SearchBean {
    private static final String DATE_TIME_PATTERN = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
    @Id
    private Long id;

    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String username;

    @Field(type = FieldType.Text)
    private String account;

    @Field(type = FieldType.Text)
    private String phone;

    @Field(type = FieldType.Text)
    private String email;

    @Field(type = FieldType.Text,analyzer = "ik_smart")
    private String tags;

    @Field(type = FieldType.Date,format = {},pattern = DATE_TIME_PATTERN)
    private Date createTime;

    @Field(type = FieldType.Date,format = {},pattern = DATE_TIME_PATTERN)
    private Date updateTime;

    @Field(type = FieldType.Integer)
    private Integer isDelete;
}
